<?
namespace app\admin\controller;

use think\Controller;
use think\Session;

class Authorized extends Controller
{
    public $pageSize = 20;

    public function _initialize()
    {
        //        安全验证，判断当前域名
        $domain=request()->domain();
        if($domain=='http://'.config('HOST')){
            if (!is_login(Session::get('admin'))) {
                $this->error('请先登录', '/admin/auth/login');
            }
        }else{
//            非设置域名，跳转404
            return $this->fetch('/404.html');
        }
    }
}
